"""添加列描述

Revision ID: 791f3248ba9c
Revises: ac416b1b733f
Create Date: 2025-11-17 13:16:24.854179

"""
from typing import Sequence, Union

from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql

# revision identifiers, used by Alembic.
revision: str = '791f3248ba9c'
down_revision: Union[str, Sequence[str], None] = 'ac416b1b733f'
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None


def upgrade() -> None:
    """Upgrade schema."""
    # ### commands auto generated by Alembic - please adjust! ###
    op.alter_column('glass', 'create_time',
               existing_type=postgresql.TIMESTAMP(),
               comment='创建时间',
               existing_nullable=True,
               existing_server_default=sa.text('now()'))
    op.alter_column('glass', 'update_time',
               existing_type=postgresql.TIMESTAMP(),
               comment='更新时间',
               existing_nullable=True,
               existing_server_default=sa.text('now()'))
    op.alter_column('glass', 'name',
               existing_type=sa.VARCHAR(),
               nullable=True,
               comment='班级名称')
    op.alter_column('glass', 'description',
               existing_type=sa.VARCHAR(),
               comment='班级描述',
               existing_nullable=True)
    op.alter_column('logs', 'create_time',
               existing_type=postgresql.TIMESTAMP(),
               comment='创建时间',
               existing_nullable=True,
               existing_server_default=sa.text('now()'))
    op.alter_column('logs', 'update_time',
               existing_type=postgresql.TIMESTAMP(),
               comment='更新时间',
               existing_nullable=True,
               existing_server_default=sa.text('now()'))
    # ### end Alembic commands ###


def downgrade() -> None:
    """Downgrade schema."""
    # ### commands auto generated by Alembic - please adjust! ###
    op.alter_column('logs', 'update_time',
               existing_type=postgresql.TIMESTAMP(),
               comment=None,
               existing_comment='更新时间',
               existing_nullable=True,
               existing_server_default=sa.text('now()'))
    op.alter_column('logs', 'create_time',
               existing_type=postgresql.TIMESTAMP(),
               comment=None,
               existing_comment='创建时间',
               existing_nullable=True,
               existing_server_default=sa.text('now()'))
    op.alter_column('glass', 'description',
               existing_type=sa.VARCHAR(),
               comment=None,
               existing_comment='班级描述',
               existing_nullable=True)
    op.alter_column('glass', 'name',
               existing_type=sa.VARCHAR(),
               nullable=False,
               comment=None,
               existing_comment='班级名称')
    op.alter_column('glass', 'update_time',
               existing_type=postgresql.TIMESTAMP(),
               comment=None,
               existing_comment='更新时间',
               existing_nullable=True,
               existing_server_default=sa.text('now()'))
    op.alter_column('glass', 'create_time',
               existing_type=postgresql.TIMESTAMP(),
               comment=None,
               existing_comment='创建时间',
               existing_nullable=True,
               existing_server_default=sa.text('now()'))
    # ### end Alembic commands ###
